import unittest
from time import sleep

from common.decorators import mkdir_classname, log4gs
from common.settings import TAG
from common.vue.select import OperateSelect
from pages_example.eleFenceManagePage import EleFenceManagePage


@log4gs
@mkdir_classname(TAG)
class EleFenceManageTest(unittest.TestCase):
    """电子围栏管理功能测试"""
    @classmethod
    def setUpClass(cls):
        cls.log.info('=' * 30 + "开始电子围栏管理功能测试({})".format(__class__.__name__) + '=' * 30)
        cls.page = EleFenceManagePage('/DevManage/EleFenceManage')

    @classmethod
    def tearDownClass(cls):
        cls.log.info('=' * 30 + "结束电子围栏管理功能测试({})".format(__class__.__name__) + '=' * 30)
        cls.page.driver.quit()

    def setUp(self):
        self.log.info('>>>>>开始执行用例：{} {}'.format(self.id(), self.shortDescription()))

    def tearDown(self):
        self.log.info('<<<<<结束执行用例：{} {}'.format(self.id(), self.shortDescription()))

    def test_1(self):
        """举例：点击搜索结果的查看按钮"""
        result = self.page.table.get_row("名乐公园东门")
        sleep(1)
        OperateSelect(result, tip="查看")
        sleep(3)


if __name__ == '__main__':
    unittest.main()